﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace eOrdered.Models
{
    public class rest_CompanyQueries : Irest_CompanyQueries
    {
        eOrderedEntities db = new eOrderedEntities();
        #region Irest_CompanyQueries Members

        public IQueryable<rest_Company> GetAllCompanies()
        {
            return db.rest_Company;
        }

        public rest_Company GetCompany(Guid id)
        {
            return db.rest_Company.SingleOrDefault(c => c.CompanyID == id);
        }

        public rest_Company GetCompany(string strName)
        {
            return db.rest_Company.SingleOrDefault(c => c.CompanyName == strName);
        }

        public void Save()
        {
            db.SaveChanges();
        }

        public void Add(rest_Company company)
        {
            db.AddTorest_Company(company);
            db.SaveChanges();
        }

    

        public void Delete(rest_Company company)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
